﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Quenmatkhau : System.Web.UI.Page
{
    eStoreDataContext db = new eStoreDataContext();
    protected void Page_Load(object sender, EventArgs e)
    {
        String username = Request["tdn"];
        String em = Request["email"];
        // Response.Write("<script>alert("+username+","+em+")</script>");
        try
        {
            var user = db.Customers
                .Single(c => c.CusId == username && c.Email == em);
            String from = "nguyentruong3168@gmail.com";
            String to = em;
            String subject = "Forgot password";
            String body = "Your password is " + user.Password;
            Mail.Send(from, to, subject, body);
            Response.Write("var msg = {status:true}");
        }
        catch
        {
            Response.Write("var msg = {status:false}");
        }
    }
}